import RPlan from "./components/RPlan";

export default function App() {
  const planData = {
    Plan: {
      "Node Type": "Sort",
      "Parallel Aware": false,
      "Startup Cost": 624.86,
      "Total Cost": 625.88,
      "Plan Rows": 410,
      "Plan Width": 726,
      "Actual Startup Time": 6.039,
      "Actual Total Time": 6.088,
      "Actual Rows": 339,
      "Actual Loops": 1,
      Output: [
        "rel_users_exams.user_username",
        "rel_users_exams.exam_id",
        "rel_users_exams.started_at",
        "rel_users_exams.finished_at",
        "answer_1.id",
        "answer_1.text",
        "answer_1.correct",
        "answer_1.fraction",
        "answer_1.question_id",
        "question_1.id",
        "question_1.title",
        "question_1.text",
        "question_1.file",
        "question_1.type",
        "question_1.source",
        "question_1.exam_id",
        "exam_1.id",
        "exam_1.title",
        "exam_1.date_from",
        "exam_1.date_to",
        "exam_1.created",
        "exam_1.created_by_",
        "exam_1.duration",
        "exam_1.success_threshold",
        "exam_1.published",
      ],
      "Sort Key": ["question_1.id"],
      "Sort Method": "quicksort",
      "Sort Space Used": 409,
      "Sort Space Type": "Memory",
      "Shared Hit Blocks": 363,
      "Shared Read Blocks": 0,
      "Shared Dirtied Blocks": 0,
      "Shared Written Blocks": 0,
      "Local Hit Blocks": 0,
      "Local Read Blocks": 0,
      "Local Dirtied Blocks": 0,
      "Local Written Blocks": 0,
      "Temp Read Blocks": 0,
      "Temp Written Blocks": 0,
      Plans: [
        {
          "Node Type": "Nested Loop",
          "Parent Relationship": "Outer",
          "Parallel Aware": false,
          "Join Type": "Left",
          "Startup Cost": 228.6,
          "Total Cost": 607.06,
          "Plan Rows": 410,
          "Plan Width": 726,
          "Actual Startup Time": 1.074,
          "Actual Total Time": 5.576,
          "Actual Rows": 339,
          "Actual Loops": 1,
          Output: [
            "rel_users_exams.user_username",
            "rel_users_exams.exam_id",
            "rel_users_exams.started_at",
            "rel_users_exams.finished_at",
            "answer_1.id",
            "answer_1.text",
            "answer_1.correct",
            "answer_1.fraction",
            "answer_1.question_id",
            "question_1.id",
            "question_1.title",
            "question_1.text",
            "question_1.file",
            "question_1.type",
            "question_1.source",
            "question_1.exam_id",
            "exam_1.id",
            "exam_1.title",
            "exam_1.date_from",
            "exam_1.date_to",
            "exam_1.created",
            "exam_1.created_by_",
            "exam_1.duration",
            "exam_1.success_threshold",
            "exam_1.published",
          ],
          "Join Filter": "(exam_1.id = question_1.exam_id)",
          "Rows Removed by Join Filter": 0,
          "Shared Hit Blocks": 360,
          "Shared Read Blocks": 0,
          "Shared Dirtied Blocks": 0,
          "Shared Written Blocks": 0,
          "Local Hit Blocks": 0,
          "Local Read Blocks": 0,
          "Local Dirtied Blocks": 0,
          "Local Written Blocks": 0,
          "Temp Read Blocks": 0,
          "Temp Written Blocks": 0,
          Plans: [
            {
              "Node Type": "Nested Loop",
              "Parent Relationship": "Outer",
              "Parallel Aware": false,
              "Join Type": "Left",
              "Startup Cost": 0.0,
              "Total Cost": 2.94,
              "Plan Rows": 1,
              "Plan Width": 99,
              "Actual Startup Time": 0.025,
              "Actual Total Time": 0.033,
              "Actual Rows": 1,
              "Actual Loops": 1,
              Output: [
                "rel_users_exams.user_username",
                "rel_users_exams.exam_id",
                "rel_users_exams.started_at",
                "rel_users_exams.finished_at",
                "exam_1.id",
                "exam_1.title",
                "exam_1.date_from",
                "exam_1.date_to",
                "exam_1.created",
                "exam_1.created_by_",
                "exam_1.duration",
                "exam_1.success_threshold",
                "exam_1.published",
              ],
              "Join Filter": "(exam_1.id = rel_users_exams.exam_id)",
              "Rows Removed by Join Filter": 0,
              "Shared Hit Blocks": 2,
              "Shared Read Blocks": 0,
              "Shared Dirtied Blocks": 0,
              "Shared Written Blocks": 0,
              "Local Hit Blocks": 0,
              "Local Read Blocks": 0,
              "Local Dirtied Blocks": 0,
              "Local Written Blocks": 0,
              "Temp Read Blocks": 0,
              "Temp Written Blocks": 0,
              Plans: [
                {
                  "Node Type": "Seq Scan",
                  "Parent Relationship": "Outer",
                  "Parallel Aware": false,
                  "Relation Name": "rel_users_exams",
                  Schema: "public",
                  Alias: "rel_users_exams",
                  "Startup Cost": 0.0,
                  "Total Cost": 1.73,
                  "Plan Rows": 1,
                  "Plan Width": 27,
                  "Actual Startup Time": 0.016,
                  "Actual Total Time": 0.021,
                  "Actual Rows": 1,
                  "Actual Loops": 1,
                  Output: [
                    "rel_users_exams.user_username",
                    "rel_users_exams.exam_id",
                    "rel_users_exams.started_at",
                    "rel_users_exams.finished_at",
                  ],
                  Filter:
                    "((rel_users_exams.exam_id = 1) AND ((rel_users_exams.user_username)::text = 'nicolas1'::text))",
                  "Rows Removed by Filter": 56,
                  "Shared Hit Blocks": 1,
                  "Shared Read Blocks": 0,
                  "Shared Dirtied Blocks": 0,
                  "Shared Written Blocks": 0,
                  "Local Hit Blocks": 0,
                  "Local Read Blocks": 0,
                  "Local Dirtied Blocks": 0,
                  "Local Written Blocks": 0,
                  "Temp Read Blocks": 0,
                  "Temp Written Blocks": 0,
                },
                {
                  "Node Type": "Seq Scan",
                  "Parent Relationship": "Inner",
                  "Parallel Aware": false,
                  "Relation Name": "exam",
                  Schema: "public",
                  Alias: "exam_1",
                  "Startup Cost": 0.0,
                  "Total Cost": 1.19,
                  "Plan Rows": 1,
                  "Plan Width": 72,
                  "Actual Startup Time": 0.006,
                  "Actual Total Time": 0.009,
                  "Actual Rows": 1,
                  "Actual Loops": 1,
                  Output: [
                    "exam_1.id",
                    "exam_1.title",
                    "exam_1.date_from",
                    "exam_1.date_to",
                    "exam_1.created",
                    "exam_1.created_by_",
                    "exam_1.duration",
                    "exam_1.success_threshold",
                    "exam_1.published",
                  ],
                  Filter: "(exam_1.id = 1)",
                  "Rows Removed by Filter": 35,
                  "Shared Hit Blocks": 1,
                  "Shared Read Blocks": 0,
                  "Shared Dirtied Blocks": 0,
                  "Shared Written Blocks": 0,
                  "Local Hit Blocks": 0,
                  "Local Read Blocks": 0,
                  "Local Dirtied Blocks": 0,
                  "Local Written Blocks": 0,
                  "Temp Read Blocks": 0,
                  "Temp Written Blocks": 0,
                },
              ],
            },
            {
              "Node Type": "Hash Join",
              "Parent Relationship": "Inner",
              "Parallel Aware": false,
              "Join Type": "Right",
              "Startup Cost": 228.6,
              "Total Cost": 599.0,
              "Plan Rows": 410,
              "Plan Width": 627,
              "Actual Startup Time": 1.047,
              "Actual Total Time": 5.42,
              "Actual Rows": 339,
              "Actual Loops": 1,
              Output: [
                "question_1.id",
                "question_1.title",
                "question_1.text",
                "question_1.file",
                "question_1.type",
                "question_1.source",
                "question_1.exam_id",
                "answer_1.id",
                "answer_1.text",
                "answer_1.correct",
                "answer_1.fraction",
                "answer_1.question_id",
              ],
              "Hash Cond": "(answer_1.question_id = question_1.id)",
              "Shared Hit Blocks": 358,
              "Shared Read Blocks": 0,
              "Shared Dirtied Blocks": 0,
              "Shared Written Blocks": 0,
              "Local Hit Blocks": 0,
              "Local Read Blocks": 0,
              "Local Dirtied Blocks": 0,
              "Local Written Blocks": 0,
              "Temp Read Blocks": 0,
              "Temp Written Blocks": 0,
              Plans: [
                {
                  "Node Type": "Seq Scan",
                  "Parent Relationship": "Outer",
                  "Parallel Aware": false,
                  "Relation Name": "answer",
                  Schema: "public",
                  Alias: "answer_1",
                  "Startup Cost": 0.0,
                  "Total Cost": 311.13,
                  "Plan Rows": 14713,
                  "Plan Width": 55,
                  "Actual Startup Time": 0.007,
                  "Actual Total Time": 1.962,
                  "Actual Rows": 14726,
                  "Actual Loops": 1,
                  Output: [
                    "answer_1.id",
                    "answer_1.text",
                    "answer_1.correct",
                    "answer_1.fraction",
                    "answer_1.question_id",
                  ],
                  "Shared Hit Blocks": 164,
                  "Shared Read Blocks": 0,
                  "Shared Dirtied Blocks": 0,
                  "Shared Written Blocks": 0,
                  "Local Hit Blocks": 0,
                  "Local Read Blocks": 0,
                  "Local Dirtied Blocks": 0,
                  "Local Written Blocks": 0,
                  "Temp Read Blocks": 0,
                  "Temp Written Blocks": 0,
                },
                {
                  "Node Type": "Hash",
                  "Parent Relationship": "Inner",
                  "Parallel Aware": false,
                  "Startup Cost": 227.66,
                  "Total Cost": 227.66,
                  "Plan Rows": 75,
                  "Plan Width": 572,
                  "Actual Startup Time": 1.025,
                  "Actual Total Time": 1.025,
                  "Actual Rows": 63,
                  "Actual Loops": 1,
                  Output: [
                    "question_1.id",
                    "question_1.title",
                    "question_1.text",
                    "question_1.file",
                    "question_1.type",
                    "question_1.source",
                    "question_1.exam_id",
                  ],
                  "Hash Buckets": 1024,
                  "Original Hash Buckets": 1024,
                  "Hash Batches": 1,
                  "Original Hash Batches": 1,
                  "Peak Memory Usage": 46,
                  "Shared Hit Blocks": 194,
                  "Shared Read Blocks": 0,
                  "Shared Dirtied Blocks": 0,
                  "Shared Written Blocks": 0,
                  "Local Hit Blocks": 0,
                  "Local Read Blocks": 0,
                  "Local Dirtied Blocks": 0,
                  "Local Written Blocks": 0,
                  "Temp Read Blocks": 0,
                  "Temp Written Blocks": 0,
                  Plans: [
                    {
                      "Node Type": "Seq Scan",
                      "Parent Relationship": "Outer",
                      "Parallel Aware": false,
                      "Relation Name": "question",
                      Schema: "public",
                      Alias: "question_1",
                      "Startup Cost": 0.0,
                      "Total Cost": 227.66,
                      "Plan Rows": 75,
                      "Plan Width": 572,
                      "Actual Startup Time": 0.004,
                      "Actual Total Time": 0.984,
                      "Actual Rows": 63,
                      "Actual Loops": 1,
                      Output: [
                        "question_1.id",
                        "question_1.title",
                        "question_1.text",
                        "question_1.file",
                        "question_1.type",
                        "question_1.source",
                        "question_1.exam_id",
                      ],
                      Filter: "(question_1.exam_id = 1)",
                      "Rows Removed by Filter": 2637,
                      "Shared Hit Blocks": 194,
                      "Shared Read Blocks": 0,
                      "Shared Dirtied Blocks": 0,
                      "Shared Written Blocks": 0,
                      "Local Hit Blocks": 0,
                      "Local Read Blocks": 0,
                      "Local Dirtied Blocks": 0,
                      "Local Written Blocks": 0,
                      "Temp Read Blocks": 0,
                      "Temp Written Blocks": 0,
                    },
                  ],
                },
              ],
            },
          ],
        },
      ],
    },
  };
  return (
    <div style={{ width: "90vw", height: "90vh" }}>
      <RPlan planSource={planData} />
    </div>
  );
}
